<?php

use think\migration\Migrator;
use think\migration\db\Column;

class UserDayReport extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change()
    {
        $table  =  $this->table('user_day_report',array('comment'=>'日报表'));
        $table
        ->addColumn('user_id', 'integer', array('limit' => 11,'default'=>0,"comment"=>"用户id","null"=>true))
        ->addColumn('rec_count', 'integer',array('limit'  => 11,'default'=>0,'comment'=>'推荐总人数',"null"=>true))
        ->addColumn('date', 'integer',array('limit'  => 11,'comment'=>'生成日期',"null"=>true))
        ->addColumn('money', 'float',array('limit'  => "10,2",'comment'=>'今日收入',"null"=>true))
        ->addColumn('createtime', 'integer', array('limit' => 10,"comment"=>"新增时间","null"=>true))
        ->addColumn('updatetime', 'integer', array('limit' => 10,"comment"=>"更新时间","null"=>true))
        ->addIndex(array('user_id'))
        ->addIndex(array('date'))
        ->create();
    }
}
